package com.slkj.shilixiaoyuanapp.entity.parent;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.List;

/**
 * 作者：何磊 on 2018/10/11 16:07
 * 描述：
 */
public class AskLeaveRecordEntity implements Parcelable {
        /**
         * id : 27
         * name : 胡峻熙
         * type : 1
         * startDate : 2018-10-13 14:51:58
         * endDate : 2018-10-13 14:51:58
         * duration : 2.0
         * body : sadas
         * state : 0
         * auditor : []
         * refute :
         * img : ["http://47.106.8.136:8081/images/school0/auditMaterialLeave/1539413517941.png"]
         * urge : false
         */

        private int id;
        private String name;
        private int type;
        private String startDate;
        private String endDate;
        private double duration;
        private String body;
        private int state;
        private String refute;
        private boolean urge;
        private List<AuditorEntity> auditor;
        private List<String> img;
        private int myState;
        private String myRefute;

    protected AskLeaveRecordEntity(Parcel in) {
        id = in.readInt();
        name = in.readString();
        type = in.readInt();
        startDate = in.readString();
        endDate = in.readString();
        duration = in.readDouble();
        body = in.readString();
        state = in.readInt();
        refute = in.readString();
        urge = in.readByte() != 0;
        auditor = in.createTypedArrayList(AuditorEntity.CREATOR);
        img = in.createStringArrayList();
        myState=in.readInt();
        myRefute=in.readString();
    }

    public static final Creator<AskLeaveRecordEntity> CREATOR = new Creator<AskLeaveRecordEntity>() {
        @Override
        public AskLeaveRecordEntity createFromParcel(Parcel in) {
            return new AskLeaveRecordEntity(in);
        }

        @Override
        public AskLeaveRecordEntity[] newArray(int size) {
            return new AskLeaveRecordEntity[size];
        }
    };

    public int getMyState() {
        return myState;
    }

    public void setMyState(int myState) {
        this.myState = myState;
    }

    public String getMyRefute() {
        return myRefute;
    }

    public void setMyRefute(String myRefute) {
        this.myRefute = myRefute;
    }

    public int getId() {
            return id;
        }

        public void setId(int id) {
            this.id = id;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public int getType() {
            return type;
        }

        public void setType(int type) {
            this.type = type;
        }

        public String getStartDate() {
            return startDate;
        }

        public void setStartDate(String startDate) {
            this.startDate = startDate;
        }

        public String getEndDate() {
            return endDate;
        }

        public void setEndDate(String endDate) {
            this.endDate = endDate;
        }

        public double getDuration() {
            return duration;
        }

        public void setDuration(double duration) {
            this.duration = duration;
        }

        public String getBody() {
            return body;
        }

        public void setBody(String body) {
            this.body = body;
        }

        public int getState() {
            return state;
        }

        public void setState(int state) {
            this.state = state;
        }

        public String getRefute() {
            return refute;
        }

        public void setRefute(String refute) {
            this.refute = refute;
        }

        public boolean isUrge() {
            return urge;
        }

        public void setUrge(boolean urge) {
            this.urge = urge;
        }

        public List<AuditorEntity> getAuditor() {
            return auditor;
        }

        public void setAuditor(List<AuditorEntity> auditor) {
            this.auditor = auditor;
        }

        public List<String> getImg() {
            return img;
        }

        public void setImg(List<String> img) {
            this.img = img;
        }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(id);
        dest.writeString(name);
        dest.writeInt(type);
        dest.writeString(startDate);
        dest.writeString(endDate);
        dest.writeDouble(duration);
        dest.writeString(body);
        dest.writeInt(state);
        dest.writeString(refute);
        dest.writeByte((byte) (urge ? 1 : 0));
        dest.writeTypedList(auditor);
        dest.writeStringList(img);
        dest.writeInt(myState);
        dest.writeString(myRefute);
    }

    public static class AuditorEntity implements Parcelable{
        /**
         * uId : 4
         * uName : 邓平平
         * headImg : http://47.106.8.136:8081/images/school3/head/1534823090482.png
         * state : 0
         * refute :
         */

        private int uId;
        private String uName;
        private String headImg;
        private int state;
        private String refute;

        protected AuditorEntity(Parcel in) {
            uId = in.readInt();
            uName = in.readString();
            headImg = in.readString();
            state = in.readInt();
            refute = in.readString();
        }

        public static final Creator<AuditorEntity> CREATOR = new Creator<AuditorEntity>() {
            @Override
            public AuditorEntity createFromParcel(Parcel in) {
                return new AuditorEntity(in);
            }

            @Override
            public AuditorEntity[] newArray(int size) {
                return new AuditorEntity[size];
            }
        };

        public int getUId() {
            return uId;
        }

        public void setUId(int uId) {
            this.uId = uId;
        }

        public String getUName() {
            return uName;
        }

        public void setUName(String uName) {
            this.uName = uName;
        }

        public String getHeadImg() {
            return headImg;
        }

        public void setHeadImg(String headImg) {
            this.headImg = headImg;
        }

        public int getState() {
            return state;
        }

        public void setState(int state) {
            this.state = state;
        }

        public String getRefute() {
            return refute;
        }

        public void setRefute(String refute) {
            this.refute = refute;
        }

        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeInt(uId);
            dest.writeString(uName);
            dest.writeString(headImg);
            dest.writeInt(state);
            dest.writeString(refute);
        }
    }
}
